/*

	This file is part of EpicManager

	Copyright (C) 2011 by Team ESO

	Permission is hereby granted, free of charge, to any person obtaining a copy
	of this software and associated documentation files (the "Software"), to deal
	in the Software without restriction, including without limitation the rights
	to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
	copies of the Software, and to permit persons to whom the Software is
	furnished to do so, subject to the following conditions:

	The above copyright notice and this permission notice shall be included in
	all copies or substantial portions of the Software.

	THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
	IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
	FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
	AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
	LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
	OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
	THE SOFTWARE.

*/

/**
 * @author sir.manic@gmail.com
 * @license MIT License
 */

package com.epicsagaonline.bukkit.EpicManager.auth;

/**
 * A class that can authenticate a user by it's name.
 *
 * @author _sir_maniac
 */
public interface PlayerAuthenticator {
	/**
	 * @param player
	 * @return true if name is allowed under criteria of object instance
	 */
	boolean isAllowed(String name);

	/**
	 * Returns the reason banned.  If no reason is available, returns null.
	 * 
	 *  WARNING: can return null when player is banned, so don't rely on this
	 *    return to verify if the user is banned.
	 * 
	 * @param player
	 * @return null, reason given
	 */
	String getBannedReason(String name);
	
	/**
	 * change authenticator to guarantee this user is allowed.
	 * @param player
	 */
	void accept(String name);

	/**
	 * change authenticator to guarantee this user is disallowed
	 * @param name
	 */
	void deny(String name);

	/**
	 * change authenticator to guarantee the user is disallowed
	 * @param player
	 * @param reason the reason the player was banned, which is included
	 *        in the kick message.  can be null.
	 */
	void deny(String name, String reason);

}
